<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>flex布局-test</title>
    <style>
        .father {
            display: flex;
            width: 80%;
            margin: 0 auto;
            gap: 10px;
            border: 1px solid red;
        }

        .item {
            flex: auto;
            width: 50px;
            height: 200px;
        }

        .father .item:nth-child(odd) {
            background-color: pink;
        }

        .father .item:nth-child(even) {
            background-color: skyblue;
        }
    </style>
</head>

<body>
    <div class="father">
        <div class="item">1</div>
        <div class="item">2</div>
        <div class="item">3</div>
        <div class="item">4</div>
    </div>
</body>

</html>